package HallCallStrategy;

import java.util.ArrayList;
import java.util.Random;

import Dispatcher.ElevatorStatus;

public class EasyHallCallStrategy implements HallCallStrategy {
	
	public EasyHallCallStrategy() {
		super();
	}

	@Override
	public int getBestElevator(int requestedFloor, int direction,
			ArrayList<ElevatorStatus> status) {
		//if any elevator is free, choose it
		for (int i = 0; i < status.size(); i++) {
			if (status.get(i).getState() == 0) {
				return i;
			}
		}
		//else choose a random elevator
		Random generator = new Random();
		return generator.nextInt (status.size());
	}

}
